package com.larsgard.gedviewer.client.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.larsgard.gedviewer.shared.ajax.IsLoggedInResponse;

public class LoggedInEvent extends GwtEvent<LoggedInEvent.LoginHandler> {

    public interface LoginHandler extends EventHandler {
	public void onLoginCheckResult(IsLoggedInResponse response);
    }

    public static final Type<LoginHandler> TYPE = new Type<LoginHandler>();
    private IsLoggedInResponse response;

    @Override
    protected void dispatch(LoginHandler handler) {
	handler.onLoginCheckResult(response);
    }

    @Override
    public Type<LoginHandler> getAssociatedType() {
	return TYPE;
    }

    public void setResponse(IsLoggedInResponse response) {
	this.response = response;
    }

    public IsLoggedInResponse getResponse() {
	return response;
    }

}
